<?php

class PageController extends CController
{
	public function actionIndex()
	{
		if (array_key_exists('alias', $_GET)) {
			$page = Page::model()->find('alias=:alias', array(':alias' => $_GET['alias']));
			
			if ($page) {
				$this->setPageTitle($page->title);
				
				$this->render('show', array(
					'page'  => $page 
				));
			} else {
				$this->redirect('/');
			}
		} else {
			$this->redirect('/');
		}
	}
}